/* Copyright (c) 2025 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef __L_COMPONENT_INTEGRITY_H__
#define __L_COMPONENT_INTEGRITY_H__

#include "common.h"

class LComponentIntegrity {
private:
    string         type;
    string         version;
    uint64_t       lastUpdated;

public:
    LComponentIntegrity(const string& type, const string& version, uint64_t lastUpdated)
        : type(type), version(version), lastUpdated(lastUpdated) {};

    std::string_view GetType() const
    {
        return this->type;
    }

    std::string_view GetVersion() const
    {
        return this->version;
    }

    uint64_t GetLastUpdated()
    {
        return this->lastUpdated;
    }

    static void register_to(lua_State *L, luawrap::stack_table &t)
    {
        luawrap::restore_stack_top _s(L);

        auto cls = luawrap::lua_class<LComponentIntegrity>(L);
        cls.def_property("type", c_func_wrap(L, LComponentIntegrity::GetType));
        cls.def_property("version", c_func_wrap(L, LComponentIntegrity::GetVersion));
        cls.def_property("lastUpdated", c_func_wrap(L, LComponentIntegrity::GetLastUpdated));

        t.set("ComponentIntegrity", cls);
    }
};

 #endif // __L_COMPONENT_INTEGRITY_H__